﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Domain;

namespace Clannan.Models.JsonModel
{
    public class AreaJsonModel
    {
        private int id;
        public int ID
        {
            get { return id; }
            set { id = value; }
        }

        private string name;
        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        private int notebookid;
        public int NoteBookID
        {
            get { return notebookid; }
            set { notebookid = value; }
        }

        private string pagesort;
        public string PageSort
        {
            get { return pagesort; }
            set { pagesort = value; }
        }

        private string pagesorttype;
        public string PageSortType
        {
            get { return pagesorttype; }
            set { pagesorttype = value; }
        }

        private int pagecount;
        public int PageCount
        {
            get { return pagecount; }
            set { pagecount = value; }
        }

        /// <summary>
        /// 将对象复制给JsonModel类，防止序列化时会出现重复引用
        /// </summary>
        public AreaJsonModel Copy(AreaJsonModel areaJsonModel, Area area)
        {
            areaJsonModel.ID = area.ID;
            areaJsonModel.Name = area.Name;
            areaJsonModel.NoteBookID = area.NoteBook.ID;
            areaJsonModel.PageSort = area.PageSort;
            areaJsonModel.PageSortType = area.PageSortType;
            areaJsonModel.PageCount = area.PageCount;
            return areaJsonModel;
        }
    }
}